	
	** Uganda
	** Clean wave 3
		
	** Urban status
	
		use "$dir/rawdata/LSMS Uganda/2011/GSEC1.dta", clear
		gen w3_urban=urban==1
		
		keep HHID w3*
		ren HHID hhid
		
		tempfile urban
		save `urban', replace
		
	** Roster
		use "$dir/rawdata/LSMS Uganda/2011/GSEC2.dta", clear
		
		gen w3_female=h2q3==2 if !missing(h2q3)
		gen w3_age=h2q8
		gen w3_married=(h2q10==1 | h2q10==2) if !missing(h2q10)
		
		gen w3_inhh=h2q7<=4
		
		bys HHID: egen w3_hh_size=total(w3_inhh)
		
		ren HHID hhid
		ren PID indiv
		
		keep hhid indiv w3_*
		tempfile roster
		save `roster', replace
		
	** Illness or injury
	
		use "$dir/rawdata/LSMS Uganda/2011/GSEC5.dta", clear
	
		gen w3_illinj=h5q4==1 if !missing(h5q4)
		gen w3_illinjstopactivities=h5q6>0 if !missing(h5q6)
		replace w3_illinjstopactivities=0 if w3_illinj==0
		
		ren HHID hhid
		ren PID indiv 
		
		keep hhid indiv w3_*		
		tempfile illinj
		save `illinj', replace
		
	** Employment 
		
		use "$dir/rawdata/LSMS Uganda/2011/GSEC8.dta", clear
		
		gen w3_work_outsideHH=h8q4==1 if !missing(h8q4)
		
		gen w3_work_bizHH=(h8q6==1 | h8q8==1) if (!missing(h8q6) | !missing(h8q8))
		
		gen w3_work_agHH=(h8q12==1) if !missing(h8q12)
		
		egen w3_worked_last7days=rowmax(w3_work_outsideHH w3_work_agHH w3_work_bizHH)
		
		egen w3_work_hrs=rowtotal(h8q36a h8q36b h8q36c h8q36d h8q36e h8q36f h8q36g h8q43), mi // inludes working on a household business, agriculture, etc.
		
		ren HHID hhid
		ren PID indiv
		keep hhid indiv w3_*
		
		tempfile employment
		save `employment', replace
	
	** Disabilities
	
		*n/a
		
	** Merge and save
	
		use `roster', clear
		merge 1:1 hhid indiv using `illinj', gen(merge_illinj)
		merge 1:1 hhid indiv using `employment', gen(merge_employment)
		merge m:1 hhid using `urban', gen(merge_urban)
		
		save "$dir/data/uga_w3_individual.dta", replace
